﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
//命令所在命名控件
using System.Windows.Input;
using ZC.MUSIC.COMMAND;

namespace ZC.MUSIC.ViewModels
{
    class UserInfoViewModel
    {
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; } = "zhaichao";
        /// <summary>
        /// 密码
        /// </summary>
        public string Pwd { get; set; }

        /// <summary>
        /// 登录方式
        /// </summary>
        public List<string> LoginType { get; set; } = new List<string> { "fist", "second" };

        public ICommand LoginCommad { get; set; }

        public ICommand CheckPwdCommand { get; set; }

        public Window CurrentWindow { get; set; }
        
        public UserInfoViewModel(Window window)
        {

            CurrentWindow = window;
            LoginCommad = new LoginCommand(() =>
            {
                if (UserName.Equals("zhaichao") && "123456".Equals(Pwd))
                {
                    MessageBox.Show($"用户:{UserName}登录成功🤣！", "登录结果", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.None);
                    
                    MainWindow mainWindow = new MainWindow();
                    mainWindow.Show();
                    window.Hide();
                }
                else
                {
                    MessageBox.Show($"用户:{UserName}登录失败😂！");
                }
            });

            CheckPwdCommand = new CheckPwdCommand<bool>((ischeck) =>
            {
                MessageBox.Show($"用户是否保存密码：{ischeck}");
            });
        }
    }
}
